home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 February / PCWorld_2007-02_cd.bin / v cisle / Addons / Addons.exe / videodownloader-1.1.1-fx.xpi / chrome / videodownloader.jar / content / overlay.js < prev    next >
Text File  |  2006-08-24  |  3KB  |  84 lines

  1. /*
  2.  * Version: Open Software License v. 2.1
  3.  *
  4.  * The contents of this file are subject to the Open Software License Version
  5.  * 2.1 (the "License"); you may not use this file except in compliance with
  6.  * the License. You may obtain a copy of the License at
  7.  * http://www.opensource.org/licenses/osl-2.1.php
  8.  *
  9.  * Software distributed under the License is distributed on an "AS IS" basis,
  10.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11.  * for the specific language governing rights and limitations under the
  12.  * License.
  13.  *
  14.  * The Original Code is the VideoDownloader.
  15.  *
  16.  * The Initial Developer of the Original Code is
  17.  * Javi Moya
  18.  *
  19.  * Portions created by the Initial Developer are Copyright (C) 2006
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  * */
  24.  
  25. var instanteGlobal=0;
  26.  
  27. function clickButton(e) {
  28.  
  29.     if (e.button == 0)
  30.     {
  31.         var currentTime = new Date();
  32.             var instante = currentTime.getTime();
  33.             var dir = window.content.document.location.href;
  34.             
  35.             if (((instanteGlobal==0) || (instanteGlobal<(instante-10000))) && (dir.indexOf('javimoya.com/blog/youtube')==-1) && (dir.indexOf('videodownloader.net')==-1))
  36.             {
  37.                 instanteGlobal=instante;
  38.                 var txt = "http://videodownloader.net/get/?url=" + escape(dir) + "&orig=ffp&ver=1.1";
  39.                 window.open(txt,'VD','fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=800,height=400');                
  40.             }
  41.         }
  42.         if (e.button == 2)
  43.         { 
  44.             openPrefDialog();
  45.         }
  46.         e.preventDefault();
  47.     }
  48.  
  49.  
  50. function openPrefDialog() {
  51.  
  52.             /*var icon = document.getElementById('videodownloader-statusbar-panel');*/
  53.       window.openDialog('chrome://videodownloader/content/options.xul',
  54.          'VideoDownloader Preferences',
  55.          'chrome,centerscreen,dependent');
  56.    }
  57.    
  58. function getBoolPref(prefName, defval) {
  59.       var result = defval;
  60.       var prefservice = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
  61.       var prefs = prefservice.getBranch("");
  62.  
  63.       if (prefs.getPrefType(prefName) == prefs.PREF_BOOL)
  64.       {
  65.           result = prefs.getBoolPref(prefName);
  66.       }
  67.       return(result);
  68.  
  69. window.addEventListener("load", videodownloaderInitListener, false);
  70.  
  71. function videodownloaderInitListener(e) {
  72.     var showicon = getBoolPref("extensions.videodownloader.boolpref", true);
  73.     var icon = document.getElementById('videodownloader-statusbar-panel');
  74.     if (icon && showicon) 
  75.     {
  76.          icon.removeAttribute("hidden");
  77.     }
  78.     else
  79.     {
  80.          icon.setAttribute("hidden", true);
  81.     }
  82. }
  83.